#include "uart_app.h"

uint8_t rx_dat[30];

uint8_t rx_finish_flag = 0;
char string[20] = {"N/A"};

char string1[] = {"F1,OK"};
char string2[] = {"F1,ERROR"};
char string3[] = {"F2,OK"};
char string4[] = {"F2,ERROR"};
void UART_proc(void)
{
    if(rx_finish_flag)
    {
        rx_finish_flag = 0;

        if(rx_dat[0] == 'F' && rx_dat[1] == '1' )
        {
            if(ic_value[0] > BF_value)
            {
                //strcpy(string,string1);
                sprintf(string, "%s", string1);
            }
            else
            {
                sprintf(string, "%s", string2);
            }
        }
        else if(rx_dat[0] == 'F' && rx_dat[1] == '2' )
        {
            if (ic_value[1] > BF_value)
            {
                sprintf(string, "%s", string3);
            }
            else
            {
                sprintf(string, "%s", string4);
            }
        }
    }

}


void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
    rx_finish_flag = 1;
}
